package com.boge.study.collection;

import java.util.Arrays;
import java.util.Random;

/**
 * 用java代码将数组元素顺序颠倒
 * @author Administrator
 *
 */
public class SwapArray {

	public static void main(String[] args) {
//		System.out.println(new Random().nextInt(50) + 50); //随记生成50到100随机数
		
		String[] str = {"1", "2", "3", "4", "5", "6"};
		System.out.println(str.length);
		swapArray(str);
		System.out.println(Arrays.toString(str));
		
	}
	
	public static void swapArray(String[] str) {
		for (int i = 0; i < str.length/2; i++) {
			String temp = str[i];
			str[i] = str[str.length - i - 1];
			str[str.length - i - 1] = temp;
		}
	}
	
}
